<template>
	<view class="wid90 mar bacFFF borRad20 dis disAl mar-top20" style="box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0,0,0,0.1);height: 193rpx;">
		<view class="wid25" @click="tiaozhuan('/pages/index/finderMap')">
			<view class="dis disJuC">
				<image src="../../static/zhandian.png" style="width: 75rpx;height: 75rpx;"></image>
			</view>
			<view class="foSi25 fowe600 mar-top10 textCen">地图找人</view>
		</view>
		<view class="wid25" @click="tiaozhuan('/pages/technician/enter')">
			<view class="dis disJuC">
				<image src="../../static/banzheng.png" style="width: 75rpx;height: 75rpx;"></image>
			</view>
			<view class="foSi25 fowe600 mar-top10 textCen">技师入驻</view>
		</view>
		<view class="wid25" @click="tiaozhuan('/pages/index/league')">
			<view class="dis disJuC">
				<image src="../../static/jiuye.png" style="width: 75rpx;height: 75rpx;"></image>
			</view>
			<view class="foSi25 fowe600 mar-top10 textCen">招商加盟</view>
		</view>
		<view class="wid25" @click="tiaozhuan('/pages/index/distributor')">
			<view class="dis disJuC">
				<image src="../../static/gongjijin.png" style="width: 75rpx;height: 75rpx;"></image>
			</view>
			<view class="foSi25 fowe600 mar-top10 textCen">分销中心</view>
		</view>
		<view class="wid25"	@click="boda()">
			<view class="dis disJuC">
				<image src="../../static/kefu1.png" style="width: 75rpx;height: 75rpx;"></image>
			</view>
			<view class="foSi25 fowe600 mar-top10 textCen">联系客服</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
			}
		},
		created() {},
		methods: {
			boda() {
				var tel = uni.getStorageSync('platform').service_tel
				console.log(tel);
				uni.makePhoneCall({
					phoneNumber: tel
				})
			}, 
			tiaozhuan(url) {
				var that = this
				if(url == '/pages/technician/enter'){
					that.getUser(2)
				}else{
					uni.navigateTo({
						url: url
					})
				}
				
				// var userinfo = uni.getStorageSync('userinfo')
				// if(!userinfo && url == '/pages/index/activity'){
				// 	uni.switchTab({
				// 		url: '/pages/wode/wode'
				// 	})
				// }else{
				// 	uni.navigateTo({
				// 		url: url
				// 	})
				// }
			},
			getUser(type){
				var that = this
				uni.showLoading({
					title:'加载中...'
				})
				uni.request({
					url: that.global.url+'api/qianyu_smfw/user/userinfo',
					method: 'POST',
					header:{
						'site-id':that.global.site_id,
						'token': uni.getStorageSync('token')
					},
					data: {},
					success(res) {
					    let result = res.data
					    if(result.code == 1){
							let userinfo = result.data
							if(type == 2){
								if(userinfo.tech_id){
									uni.setStorageSync('switch_tech',1)
									uni.switchTab({
										url:'/pages/wode/wode'
									})
								}else{
									uni.navigateTo({
										url:'/pages/technician/enter'
									})
								}
							}
						}else{
							
					    }
					},
					complete() {
						uni.hideLoading()
					}
				})
			},
			
		}
	}
</script>

<style>
</style>